		function readURL(input, img_obj){		
		    if (input.files && input.files[0]){	    	
		        var reader = new FileReader();
		
		        reader.onload = function (e) {		        
		            img_obj.attr('src', e.target.result);	            
		        };	
		        reader.readAsDataURL(input.files[0]);
		    }
		}
		function autoclosealert(selector, delay) {
		   var alert = $(selector).alert();
		   window.setTimeout(function() { alert.fadeOut(1000) }, delay);
		}
		function create_confirm_model(url_action, pams, message, ajax){
			if (message === null)
				message = 'ยืนยันการดำเนินการ';
			if (ajax === null)
				ajax = false;
			
			var html = '<div class="modal-confirm modal hide fade">';
			html +=	'<div class="modal-header">';
			html += '	<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>';		
			html += '</div>';
			html += '<div class="modal-body">';
			html += '	<form id="frm-confirm" action="' + url_action + '" method="post">';
			
			for (var key in pams){
				html += '<input type="hidden" name="' + key + '" value="' + pams[key] + '" />';
			}
			
			html += '	<p>' + message + '</p>';
			html += '	</form>';
			html += '</div>';
			html += '<div class="modal-footer">';
			html += '	<div id="panel-opr" style="float:left;"></div>';
			html += '	<a href="#" class="btn" data-dismiss="modal" aria-hidden="true">ปิด</a>';
			html += '	<a href="#" class="btn btn-primary" id="btn-save">บันทึก</a>';
			html += '</div>';
			html += '</div>';

			$('body').append(html);
			$('.modal-confirm').modal('show');
			$('.modal-confirm').on('hide', function(){
				$(this).remove();
			});

			$('.modal-confirm #btn-save').click(function(){				
				if (ajax){
					$('.modal-confirm .btn').attr('disabled','disabled');
					
					$('.modal-confirm #frm-confirm').ajaxSubmit({			
						success: function(output){
							output = JSON.parse(output);
							if (output.result)
								html = '<div class="alert alert-success">';						
							else 
								html = '<div class="alert alert-error">';				
							html += output.message + '</div>';					
							$('.modal-confirm .panel-message').html(html);

							$('.modal-confirm button').attr('disabled','disabled');
							setTimeout(function(){ window.location.reload() }, 1500);					
						}
					});
				} else
					$('.modal-confirm #frm-confirm').submit();				
			});		
		}
	